﻿@model Orion.Models.HomeIndexViewModel  
           
<script src="@Url.Content("~/Scripts/Home.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Pagination/jquery.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Pagination/jquery.pagination.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Pagination/jquery.pag.js")" type="text/javascript"></script>
                            
@{
    ViewBag.Title = "IRIS - Forsíða";
}

<section id="main_center_content">
<!-- incase model is empty -->
    @if(Model.MainNewsArticle != null)
    {
            DateTime temp = Model.MainNewsArticle.ContentDate;
		    <article class="head">
			    <h1><a href="/NewsArticle/NewsArticleById/@Model.MainNewsArticle.ID">@Model.MainNewsArticle.Title</a></h1>
			    <span class="left">Höf: @Model.MainNewsArticle.Author</span>
			    <span class="right">@temp.ToString("dd MMMM yyyy")</span>
                <div class="clear"></div>
			    @if ((Model.MainNewsArticle.Picture != "no pic" && Model.MainNewsArticle.Picture != null) && Model.MainNewsArticle.ContentType == 2)
       {
                                <div class="shortenMeIndexLong">
                                <img  src="@Model.MainNewsArticle.Picture" alt="@Model.MainNewsArticle.Picture"  class="imgInTextLeft" />
                                @Html.Raw(Model.MainNewsArticle.TextBody)</div> 
       }
       else
       {
                            <div class="shortenMeSingle">@Html.Raw(Model.MainNewsArticle.TextBody)</div> 
       }
                <a href="/NewsArticle/NewsArticleById/@Model.MainNewsArticle.ID">Lesa Meira >></a>

		    </article>
		
                                                 foreach (var n in Model.NewsArticle)
                                                 {
                                                     DateTime temp2 = n.ContentDate;
		    <article class="single">
			    <h1><a href="/NewsArticle/NewsArticleById/@n.ID">@n.Title</a></h1>
			    <span class="left">Höf: @n.Author</span>
			    <span class="right">@temp2.ToString("dd MMMM yyyy")</span>
                <div class="clear"></div>
                @if ((n.Picture != "no pic" && n.Picture != null) && n.ContentType == 2)
                {
                                <div class="shortenMeSingleImg">
                                <img  src="@n.Picture" alt="@n.Picture" class="imgInTextLeft" />
                                @Html.Raw(n.TextBody)</div> 
                }
                else
                {
                            <div class="shortenMeSingle">@Html.Raw(n.TextBody)</div> 
                }
                <a href="/NewsArticle/NewsArticleById/@n.ID">Lesa Meira >></a>
                
		    </article>
                                                 }
    }
	</section>
	
	<section id="main_right_content">
		<div id="events">
			<h2>Næstu Atburðir</h2>
			<ul>
            @foreach (var e in Model.Events)
            {
                DateTime eventTemp = e.EventDate;
				<li class="date">@eventTemp.ToString("dd MMMM yyyy")</li>
				<li><a href="/Event/EventById/@e.ID">@e.Title</a></li>
            }
			</ul>
		</div>
        @if (Orion.Controllers.AdvertiesmentController.ShowAds(1) != "no pic")
        {
		<img class="ad" src="@Orion.Controllers.AdvertiesmentController.ShowAds(1)" alt="kfc" />
        }
		@if (Orion.Controllers.AdvertiesmentController.ShowAds(2) != "no pic")
  {
		<img class="ad" src="@Orion.Controllers.AdvertiesmentController.ShowAds(2)" alt="kfc" />
        }
	</section>

<div class="clear"></div>
